<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of LanguagesUtil
 *
 * @author Sorasak Siangsanan
 */
class LanguagesUtil {
    
    private static function languages() {
        return array(
            'th',
            'en'
        );
    }

    public static function generateLinks() {
        $languages = self::languages();
        $links = array();
        $language = Yii::app()->session['sess_lang'];
        for ($i = 0; $i < count($languages); $i++) {
            $str = $languages[$i];
            if ($language == $languages[$i]) {
                $str = "» " . strtoupper($str);
            } else {
                $str = "&nbsp;&nbsp;&nbsp;" . strtoupper($str);
            }
            $links[$i] = CHtml::link($str, array('languages/' . $languages[$i]));
        }
        return $links;
    }

}
